home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / configure.in < prev    next >
Encoding:
Text File  |  1996-05-17  |  25.9 KB  |  1,164 lines

  1. dnl
  2. dnl Configure.in file for the Midnight Commander
  3. dnl
  4. AC_INIT(create_vcs)
  5. AC_CONFIG_HEADER(config.h)
  6. undefine([mouse_support])dnl
  7.  
  8. dnl This is path where we're looking for headers in addition to /usr/include
  9. dnl and whatever cpp defaults to.
  10. include_additional_path="/usr/local/include /opt/gnu/include"
  11.  
  12. dnl This sets/resets compiling with -g by default. It should be set to yes for
  13. dnl development versions and set to no for release versions.
  14. use_cc_g_flag=yes
  15.  
  16. dnl We want autoconf to check whether -g is available
  17. dnl We reset it back soon.
  18. CCOPTS="$CFLAGS"
  19. unset CFLAGS
  20.  
  21. dnl Find out, if we should default to /usr/local or /usr
  22. AC_PREFIX_PROGRAM(mc)
  23.  
  24. AC_PROG_MAKE_SET
  25. AC_PROG_CC
  26. AC_PROG_CPP
  27. AC_PROG_RANLIB
  28. AC_PROG_LN_S
  29. AC_PROG_AWK
  30. if test x"$AWK" = x; then
  31.     AWK=":"
  32.     dep=slowdep
  33. else
  34.     dep=fastdep
  35. fi
  36. AC_SUBST(dep)
  37. AC_PROG_GNU_MAKE
  38.  
  39. AC_AIX
  40. AC_MINIX
  41. AC_ISC_POSIX
  42. AC_HEADER_MAJOR
  43. AC_C_CONST
  44. AC_PATH_PROG(MV, mv, mv)
  45. AC_PATH_PROG(CP, cp, cp)
  46. AC_PATH_PROG(RM, rm, rm)
  47. AC_PATH_PROG(CHMOD, chmod, :)
  48. AC_PATH_PROG(AR, ar, ar)
  49. AC_C_CROSS
  50.  
  51. AC_CHECK_PROG(system,uname,`uname`,unknown)
  52. AC_CHECK_PROGS(X11_WWW,netscape arena Mosaic chimera)
  53.  
  54. dnl
  55. dnl This part supplies reasonable defaults for CFLAGS, if they weren't
  56. dnl specified by ''CFLAGS=flags ./configure''
  57. dnl
  58. cc_uses_g=yes
  59. if test x$GCC = xyes; then
  60.     if test x$ac_cv_prog_gcc_g = xyes; then
  61.     :
  62.     else
  63.     cc_uses_g=no
  64.     fi
  65. fi
  66. if test "x$CCOPTS" = x; then
  67.     if test x$GCC = xyes; then
  68.         if test x$system = xLinux; then
  69.             CCOPTS='-O2 -fno-strength-reduce'
  70.         if test x$use_cc_g_flag = xyes; then
  71.         if test $cc_uses_g = yes; then
  72.             CCOPTS='-g -O'
  73.         fi
  74.         fi
  75.     else
  76.             CCOPTS='-O'
  77.         if test x$use_cc_g_flag = xyes; then
  78.         if test $cc_uses_g = yes; then
  79.             CCOPTS='-g -O'
  80.         fi
  81.         fi
  82.     fi
  83.     else
  84.     if test x$use_cc_g_flag = xyes; then
  85.         CCOPTS="$CFLAGS"
  86.     else
  87.         CCOPTS=
  88.     fi
  89.     fi
  90. fi
  91. CFLAGS="$CCOPTS"
  92.  
  93. dnl
  94. dnl For A/UX.  Do not move
  95. dnl
  96.  
  97. posix_libs=""
  98. if test $system = A/UX
  99. then
  100.     posix_libs="-lposix"
  101.     AC_DEFINE(_POSIX_SOURCE)
  102. fi
  103.  
  104. AC_PROG_INSTALL
  105. AC_CHECK_HEADERS(unistd.h string.h memory.h crypt.h grp.h limits.h)
  106. dnl (rx.h)
  107. AC_HEADER_SYS_WAIT
  108. AC_HEADER_DIRENT
  109. AC_SHORT_D_NAME_LEN
  110. AC_HEADER_STDC
  111.  
  112. dnl
  113. dnl Let me check for an incompatible regcomp in HP-UX before making this
  114. dnl the default
  115. dnl
  116. dnl if test x$ac_cv_header_rx_h = xyes; then
  117. dnl AC_CHECK_FUNCS(regcomp)
  118. dnl if test x$ac_cv_func_regcomp = xyes; then
  119. dnl     REGEX_O=""
  120. dnl fi
  121. dnl fi
  122.  
  123. REGEX_O="regex.o"
  124. AC_SUBST(REGEX_O)
  125.  
  126. dnl Missing structure components
  127. AC_STRUCT_ST_BLKSIZE
  128. AC_STRUCT_ST_BLOCKS
  129. AC_STRUCT_ST_RDEV
  130.  
  131. dnl
  132. dnl Check availability of some functions 
  133. dnl 
  134.  
  135. AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp)
  136. AC_CHECK_FUNCS(strdup pwdauth cfgetospeed truncate initgroups)
  137.  
  138. SHADOWLIB=
  139. if test x$system = xLinux; then
  140. AC_CHECK_LIB(shadow,pw_encrypt,[
  141. shadow_header=no
  142. AC_CHECK_HEADERS(shadow.h)
  143. if test x$ac_cv_header_shadow_h = xyes; then
  144.     shadow_header=yes
  145. else
  146. AC_CHECK_HEADERS(shadow/shadow.h)
  147.     if test x$ac_cv_shadow_shadow_h = xyes; then
  148.         shadow_header=yes
  149.     fi
  150. fi
  151. if test $shadow_header = yes; then
  152.     AC_DEFINE(LINUX_SHADOW)
  153.     SHADOWLIB=-lshadow
  154. fi
  155. ])
  156. fi
  157. AC_SUBST(SHADOWLIB)
  158.  
  159. NEED_CRYPT_PROTOTYPE=yes
  160. if test x$ac_cv_header_crypt_h = xyes; then
  161. AC_TRY_WARNINGS([#include <crypt.h>], [char *p = crypt("xxx", "yyy");],[
  162. NEED_CRYPT_PROTOTYPE=no])
  163. else 
  164.     if test x$ac_cv_header_unistd_h = xyes; then
  165. AC_TRY_WARNINGS([#include <unistd.h>], [char *p = crypt("xxx", "yyy");],[
  166. NEED_CRYPT_PROTOTYPE=no])
  167.     fi
  168. fi
  169. if test x$NEED_CRYPT_PROTOTYPE=xyes; then
  170. AC_DEFINE(NEED_CRYPT_PROTOTYPE)
  171. fi
  172.  
  173. dnl
  174. dnl On SCO, crypt is on libcrypt.a
  175. dnl         grantpt in  libpt.a
  176. dnl
  177. AC_CHECK_FUNCS(crypt, , [
  178.     AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt",[
  179.     AC_CHECK_LIB(crypt_i, crypt, LIBS="$LIBS -lcrypt_i")])])
  180.  
  181. dnl This is the correct version
  182. dnl AC_CHECK_FUNCS(grantpt, , AC_CHECK_LIB(pt, grantpt))
  183. dnl
  184. dnl And workaround for a Autoconf 2.4 bug:
  185. AC_CHECK_FUNCS(grantpt)
  186. if test x$ac_cv_func_grantpt = xyes; then
  187.     :
  188. else
  189.     AC_CHECK_LIB(pt, grantpt)
  190. fi
  191.  
  192. dnl
  193. dnl If running under AIX, AC_AIX does not tell us that
  194. dnl
  195. AC_MSG_CHECKING(for AIX defines)
  196. AC_EGREP_CPP(yes,
  197. [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
  198. yes
  199. #endif
  200. ], [
  201. AC_DEFINE(IS_AIX)
  202. AC_MSG_RESULT(yes)
  203. ], AC_MSG_RESULT(no))
  204.  
  205. dnl   
  206. dnl This hack is here until autoconf adds it
  207. dnl Needed for Unixware: getmntent is on libgen.a
  208. dnl
  209. AC_CHECK_LIB(gen, getmntent, [LIBS="-lgen $LIBS"])
  210.  
  211. dnl
  212. dnl This is from GNU fileutils, check aclocal.m4 for more information
  213. dnl
  214. AC_GET_FS_INFO
  215.  
  216. dnl
  217. dnl Missing typedefs and replacements
  218. dnl 
  219.  
  220. AC_TYPE_MODE_T
  221. AC_CHECK_TYPE(umode_t, int)
  222. AC_CHECK_TYPE(off_t, long)
  223. AC_TYPE_PID_T
  224. AC_TYPE_UID_T
  225.  
  226. AC_FUNC_MMAP
  227.  
  228. dnl
  229. dnl Cool hack, but we don't use it currently 
  230. dnl
  231. dnl AC_MSG_CHECKING(for token pasting method)
  232. dnl AC_EGREP_CPP(portable,[
  233. dnl #define tken(a, b) a##b
  234. dnl tken(port, able)
  235. dnl ], [AC_DEFINE(HAVE_PORTABLE_TOKEN_PASTING)
  236. dnl AC_MSG_RESULT(portable)
  237. dnl ], [
  238. dnl AC_MSG_RESULT(non-portable)
  239. dnl ])
  240.  
  241. AC_PATH_XTRA
  242.  
  243. xvers="none"
  244. mxc=""
  245. AC_PATH_XVIEW_XTRA
  246. if test "x$no_xview" != "xyes"; then
  247.     mxc="mxc"
  248.     xvers="XView"
  249.     xvdep="xvdep"
  250. else
  251.     mxc=""
  252.     xvdep=""
  253. fi
  254. AC_SUBST(mxc)
  255. AC_SUBST(xvdep)
  256.  
  257. xv_bindir=
  258. if test -n "$mxc"; then
  259. AC_ARG_WITH(xv-bindir, 
  260.         [--with-xv-bindir=dir  Specifies directory where to install XView version],[
  261.     if test x$withval = xyes; then
  262.     AC_MSG_WARN(Usage is: --with-xv-bindir=basedir)
  263.     else
  264.     if test x$withval = xno; then
  265.         AC_MSG_WARN(Usage is: --with-xv-bindir=basedir)
  266.     else
  267.         xv_bindir=$withval
  268.     fi
  269.     fi
  270. ])
  271. if test x$xv_bindir = x; then
  272.     xv_bindir=`echo $xv_includes | sed s/include/bin/`
  273.     if test ! -x $xv_bindir/openwin; then
  274.         if test ! -x $xv_bindir/olwm; then
  275.             if test ! -x $xv_bindir/olvwm; then
  276.                 xv_bindir=
  277.             fi    
  278.         fi
  279.     fi
  280. fi
  281. if test x$xv_bindir = x; then
  282.     if test "$OPENWINHOME"; then
  283.         xv_bindir=$OPENWINHOME/bin
  284.     else
  285.     AC_PATH_PROG(ac_my_xp, openwin)
  286.     if test x$ac_my_xp = x; then
  287.         AC_PATH_PROG(ac_my_xp, X)
  288.         if test x$ac_my_xp = x; then
  289.         xv_bindir=""
  290.         else
  291.         xv_bindir=`basename $ac_my_xp`
  292.          fi
  293.     else
  294.         xv_bindir=`basename $ac_my_xp`
  295.     fi
  296.     fi
  297.     if test ! -x $xv_bindir/openwin; then
  298.         if test ! -x $xv_bindir/olwm; then
  299.             if test ! -x $xv_bindir/olvwm; then
  300.         if test ! -x $xv_bindir/X; then
  301.                     xv_bindir=
  302.         fi
  303.             fi    
  304.         fi
  305.     fi
  306. fi
  307. if test x$xv_bindir = x; then
  308.     xv_bindir=$prefix/bin
  309. fi
  310. fi
  311. if test x$xv_bindir = xNONE/bin; then
  312.     xv_bindir=
  313. fi
  314. AC_SUBST(xv_bindir)
  315.  
  316. dnl
  317. dnl Network related functions
  318. dnl
  319.  
  320. AC_CHECK_FUNCS(gethostbyname, , [
  321.   AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")])
  322.  
  323. have_socket=no
  324. AC_CHECK_FUNCS(socket, have_socket=yes)
  325. if test $have_socket = no; then
  326.   # socket is not in the default libraries.  See if it's in some other.
  327.   for lib in bsd socket inet; do
  328.     AC_CHECK_LIB($lib, socket, [LIBS="$LIBS -l$lib"; have_socket=yes; break])
  329.   done
  330. fi
  331.  
  332. NETFILES=""
  333. vfs_flags="tarfs"
  334. use_net_code=false
  335. if test $have_socket = yes; then
  336.     AC_STRUCT_LINGER
  337.     AC_CHECK_FUNCS(pmap_set, , [
  338.        AC_CHECK_LIB(rpc, pmap_set, [
  339.      LIBS="-lrpc $LIBS"
  340.     AC_DEFINE(HAVE_PMAP_SET)
  341.     ])])
  342.     AC_CHECK_FUNCS(pmap_getport rresvport)
  343. dnl add for source routing support setsockopt
  344.     AC_CHECK_HEADERS(rpc/pmap_clnt.h)
  345.     vfs_flags="$vfs_flags, mcfs, ftpfs"
  346.     NETFILES="\$(NETFILES)"
  347.     use_net_code=true
  348. fi
  349. AC_SUBST(NETFILES)
  350.  
  351. screen_manager=unknown
  352. search_ncurses=false
  353.  
  354. CFLAGS=${CFLAGS--O}
  355. LDFLAGS=${LDFLAGS--O}
  356.  
  357. mouse_lib="xterm only"
  358. AC_ARG_WITH(gpm-mouse, 
  359.     [--with-gpm-mouse=base-dir  Specifies the base gpm directory],
  360.     if test x$withval = xyes
  361.     then 
  362.         AC_MSG_WARN(Usage is: --with-gpm-mouse=base-dir)
  363.     else
  364.         LIBS="$LIBS -L$withval/lib -lgpm"
  365.               AC_DEFINE(HAVE_LIBGPM)
  366.         CPPFLAGS="$CPPFLAGS -I$withval/include"
  367.             mouse_lib="GPM and xterm"
  368.         AC_MSG_RESULT(defining use_gpm)
  369.     fi
  370. )
  371.  
  372. AC_DEFUN(AC_USE_SUNOS_CURSES, [
  373.     search_ncurses=false
  374.     screen_manager="SunOS 4.x /usr/5include curses"
  375.     AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
  376.     AC_DEFINE(SUNOS_CURSES)
  377.     AC_DEFINE(NO_COLOR_SUPPORT)
  378.     AC_DEFINE(USE_SYSV_CURSES)
  379.     CPPFLAGS="$CPPFLAGS -I/usr/5include"
  380.     XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
  381.     AC_MSG_RESULT(Please note that some screen refreshs may fail)
  382.     AC_WARN(Reconsider using Slang)
  383. ])
  384.  
  385. AC_DEFUN(AC_USE_OSF1_CURSES, [
  386.        AC_MSG_RESULT(Using OSF1 curses)
  387.        search_ncurses=false
  388.        screen_manager="OSF1 curses"
  389.        AC_DEFINE(NO_COLOR_SUPPORT)
  390.        AC_DEFINE(USE_SYSV_CURSES)
  391.        XCURSES="xcurses.o"
  392.        LIBS="$LIBS -lcurses"
  393. ])
  394.  
  395. AC_DEFUN(AC_USE_SYSV_CURSES, [
  396.     AC_MSG_RESULT(Using SysV curses)
  397.     AC_DEFINE(USE_SYSV_CURSES)
  398.     XCURSES=""
  399.     search_ncurses=false
  400.     screen_manager="SysV/curses"
  401.     LIBS="$LIBS -lcurses"
  402. ])
  403.  
  404. XCURSES=""
  405. AC_SUBST(XCURSES)
  406.  
  407. dnl AC_ARG_WITH(bsd-curses,
  408. dnl [--with-bsd-curses         Used to compile with bsd curses, not very fancy],
  409. dnl     search_ncurses=false
  410. dnl    screen_manager="Ultrix/cursesX"
  411. dnl    if test $system = ULTRIX
  412. dnl    then
  413. dnl        THIS_CURSES=cursesX
  414. dnl        else
  415. dnl        THIS_CURSES=curses
  416. dnl    fi
  417. dnl
  418. dnl    LIBS="$LIBS -l$THIS_CURSES -ltermcap"
  419. dnl    AC_DEFINE(USE_BSD_CURSES)
  420. dnl    XCURSES="xcurses.o"
  421. dnl    AC_MSG_RESULT(Please note that some screen refreshs may fail)
  422. dnl    AC_WARN(Use of the bsdcurses extension has some)
  423. dnl    AC_WARN(display/input problems.)
  424. dnl    AC_WARN(Reconsider using ncurses)
  425. dnl)
  426.  
  427. AC_ARG_WITH(sco,
  428.     [--with-sco                 Use this on SCO for the subshell support],[
  429.     if test x$withval = xyes; then
  430.         AC_DEFINE(SCO_FLAVOR)
  431.     fi
  432. ])
  433.  
  434. AC_ARG_WITH(sunos-curses,
  435.     [--with-sunos-curses        Used to force SunOS 4.x curses],[
  436.     if test x$withval = xyes; then
  437.         AC_USE_SUNOS_CURSES
  438.     fi
  439. ])
  440.  
  441. AC_ARG_WITH(osf1-curses,
  442.     [--with-osf1-curses       Used to force OSF/1 curses],[
  443.     if test x$withval = xyes; then
  444.         AC_USE_OSF1_CURSES
  445.     fi
  446. ])
  447.  
  448. AC_ARG_WITH(vcurses,
  449.     [--with-vcurses[=incdir]    Used to force SysV curses],
  450.     if test x$withval = xyes; then
  451.         CPPFLAGS="$CPPFLAGS"
  452.         else
  453.         CPPFLAGS="$CPPFLAGS -I$withval"
  454.     fi
  455.     AC_USE_SYSV_CURSES
  456. )
  457.             
  458. AC_ARG_WITH(ncurses,
  459.     [--with-ncurses[=base-dir]    Compile with ncurses/locate base dir],
  460.     if test x$withval = xyes
  461.     then
  462.         search_ncurses=true
  463.     else
  464.         LIBS="$LIBS -L$withval/lib -lncurses"
  465.         CPPFLAGS="$CPPFLAGS -I$withval/include"
  466.         search_ncurses=false
  467.         screen_manager="ncurses"
  468.         AC_DEFINE(USE_NCURSES)
  469.     fi
  470. )
  471.  
  472. AC_DEFUN(TK_MSG,[
  473.         if test x$xvers = xnone; then
  474.             xvers="Tk"
  475.         else
  476.                xvers="XView and Tk"
  477.         fi
  478. ])
  479.  
  480. dnl
  481. dnl Check for Tcl/Tk, should switch to Guile/Tk soon :-)
  482. dnl
  483. tkmc=""
  484. tk_includes=""
  485. tk_libs=""
  486. if test x$no_x != xyes; then
  487.     AC_ARG_WITH(tk, 
  488.         [--with-tk                  Use the Tk toolkit],[
  489.     if test x$withval = xyes; then
  490.     tkmc="tkmc"
  491.     fi])
  492.     AC_ARG_WITH(tk-includes,
  493.         [--with-tk-includes=dir     Specifies the Tcl/Tk header directory],[
  494.     if test x$withval = xyes; then
  495.     AC_MSG_WARN(Usage is: --with-tk-includes=dir)
  496.     else
  497.     if test x$withval = xno; then
  498.         AC_MSG_WARN(Usage is: --with-tk-includes=dir)
  499.     else
  500.         tk_includes="-I$withval"
  501.         tkmc="tkmc"
  502.     fi
  503.     fi])
  504.     AC_ARG_WITH(tk-libraries,
  505.         [--with-tk-libraries=dir    Specifies the Tcl/Tk library directory],[
  506.     if test x$withval = xyes; then
  507.     AC_MSG_WARN(Usage is: --with-tk-libraries=dir)
  508.     else
  509.     if test x$withval = xno; then
  510.         AC_MSG_WARN(Usage is: --with-tk-libraries=dir)
  511.     else
  512.         tk_libs="-L$withval"
  513.         tkmc="tkmc"
  514.     fi
  515.     fi])
  516.     if test -n "$tkmc"; then 
  517.         AC_CHECKING(for Tcl/Tk)
  518.         tk_headers_found=no
  519.         if test ! -n "$tk_includes"; then
  520.         AC_CHECK_HEADER_IN_PATH(tcl.h, $include_additional_path, [
  521.             AC_CHECK_HEADER_IN_PATH(tk.h, $include_additional_path, [
  522.             tk_headers_found=yes
  523.             if test -n "$ac_cv_header_in_path_tcl_h"; then
  524.             tk_includes="-I$ac_cv_header_in_path_tcl_h";
  525.             fi
  526.             if test -n "$ac_cv_header_in_path_tk_h"; then
  527.             if test "$ac_cv_header_in_path_tk_h" != "$ac_cv_header_in_path_tcl_h"; then
  528.                 tk_includes="$tk_includes -I$ac_cv_header_in_path_tk_h" 
  529.             fi
  530.             fi
  531.             ])
  532.         ])
  533.         else
  534.         tk_headers_found=yes
  535.         fi
  536.         if test $tk_headers_found = no; then
  537.         tkmc=""
  538.         else
  539.         tk_libs_found=no
  540.         ac_save_tk_LIBS="$LIBS"
  541.         ac_save_tk_LDFLAGS="$LDFLAGS"
  542.         LIBS="$X_EXTRA_LIBS -lX11 $X_PRE_LIBS $LIBS"
  543.         LDFLAGS="$LDFLAGS $X_LIBS"
  544.             if test ! -n "$tk_libs"; then
  545.         AC_CHECK_LIB(tcl, Tcl_Eval, [
  546.             AC_CHECK_LIB(tk, Tk_CreateWindow, [
  547.             tk_libs_found=yes
  548.             ], , -ltcl -lm)
  549.         ], , -lm)
  550.         else
  551.         tk_libs_found=yes
  552.         fi
  553.         LDFLAGS="$ac_save_tk_LDFLAGS"
  554.         LIBS="$ac_save_tk_LIBS"
  555.         if test $tk_libs_found = no; then
  556.         tkmc=""
  557.         fi
  558.     fi
  559.     fi
  560. fi
  561. if test -n "$tkmc"; then
  562.     TK_MSG
  563.     tkdep="tkdep"
  564. else
  565.     tkdep=""
  566. fi
  567. AC_SUBST(tkmc)
  568. AC_SUBST(tkdep)
  569. AC_SUBST(tk_includes)
  570. AC_SUBST(tk_libs)
  571.  
  572. dnl
  573. dnl Check for the -mandoc package
  574. dnl
  575. AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
  576. if $HAVE_nroff; then
  577.     AC_MSG_CHECKING(for manual formatting macros)
  578.     AC_CACHE_VAL(ac_cv_mandoc, [
  579.     nroff -mandoc < /dev/null > /dev/null 2>&1 /dev/null
  580.     if test $? = 0
  581.     then
  582.     ac_cv_mandoc=-mandoc
  583.     else
  584.     ac_cv_mandoc=-man
  585.     fi
  586.     ])
  587.     MANDOC=$ac_cv_mandoc
  588.     AC_MSG_RESULT($MANDOC)
  589. else
  590.     MANDOC=-man
  591. fi
  592. AC_SUBST(MANDOC)
  593.  
  594. dnl
  595. dnl Check if nroff accepts -Tascii
  596. dnl
  597. if $HAVE_nroff; then
  598.     AC_MSG_CHECKING(If nroff accepts -Tascii)
  599.     AC_CACHE_VAL(ac_cv_nroff_tascii, [
  600.     nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
  601.     if test $? = 0
  602.     then
  603.     ac_cv_nroff_tascii=" -Tascii"
  604.         AC_MSG_RESULT(yes)
  605.     else
  606.     ac_cv_nroff_tascii=""
  607.         AC_MSG_RESULT(no)
  608.     fi
  609.     ])
  610. fi
  611. TROFFASCII="$ac_cv_nroff_tascii"
  612. AC_SUBST(TROFFASCII)
  613.  
  614. dnl
  615. dnl Check for - option to file
  616. dnl
  617. AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
  618. if $HAVE_FILECMD; then
  619.     AC_MSG_CHECKING(for - option to file command)
  620.     AC_CACHE_VAL(ac_cv_filestdin, [
  621.     cat > conftest.c <<EOF
  622. /* A comment */
  623. #if 0
  624. #endif
  625. void main(void)
  626. { return; }
  627. EOF
  628.     changequote(, )
  629.     cat > conftest.sed <<EOF
  630. s/^[^:]*:[\ \    ]*//
  631. s/[\ \    ]*$//
  632. EOF
  633.     filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
  634.     filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
  635.     if test "$filehyphen_1" = "$filehyphen_2"; then
  636.     ac_cv_filestdin=yes
  637.     else
  638.     ac_cv_filestdin=no
  639.     fi
  640.     changequote([, ])
  641.     rm conftest.c conftest.sed
  642.     unset filehyphen_1
  643.     unset filehyphen_2
  644.     ])
  645.  
  646.     if test x$ac_cv_filestdin = xyes; then
  647.     AC_DEFINE(FILE_STDIN)
  648.     fi
  649.     filestdin=$ac_cv_filestdin
  650.     AC_MSG_RESULT($filestdin)
  651.  
  652.     dnl
  653.     dnl Check for -L option to file
  654.     dnl
  655.  
  656. AC_MSG_CHECKING(for -L option to file command)
  657. AC_CACHE_VAL(ac_cv_filel, [
  658. file -L . > /dev/null 2>&1
  659. if test $? = 0
  660. then
  661.     ac_cv_filel=yes
  662. else
  663.     ac_cv_filel=no
  664. fi
  665. ])
  666. if test x$ac_cv_filel = xyes; then
  667.     AC_DEFINE(FILE_L)
  668. fi
  669. filel=$ac_cv_filel
  670. AC_MSG_RESULT($filel)
  671. fi 
  672.  
  673. dnl
  674. dnl HAVE_DUSUM is on by default, only if you have a strange du, you can
  675. dnl turn it off by --without-dusum
  676. dnl
  677. have_dusum=yes
  678. AC_MSG_CHECKING(for du arguments)
  679. AC_ARG_WITH(dusum, 
  680.     [--with-dusum               Support the du -s summaries],[
  681.     if test x$withval = xno; then
  682.         have_dusum=no
  683.     fi
  684. ])
  685. if test x$have_dusum = xyes; then
  686.     AC_DEFINE(HAVE_DUSUM)
  687.     AC_CACHE_VAL(ac_cv_dusum, [
  688.     du -s -b $srcdir/configure >/dev/null 2>&1
  689.     if test $? = 0; then
  690.         ac_cv_dusum='dusum_useb=yes; dusum_factor=1'
  691.     else
  692.     ac_cv_dusum='dusum_useb=; dusum_factor=512'
  693.     fi
  694. ])
  695.     eval "$ac_cv_dusum"
  696.     if test x$dusum_useb = xyes; then
  697.     AC_DEFINE(DUSUM_USEB)
  698.     AC_MSG_RESULT(-b)
  699.     else
  700.     AC_MSG_RESULT(block size $dusum_factor)
  701.     fi
  702.     AC_DEFINE_UNQUOTED(DUSUM_FACTOR, $dusum_factor)
  703. fi
  704.  
  705. dnl
  706. dnl The termnet support
  707. dnl
  708. termnet=false
  709. AC_ARG_WITH(termnet,
  710.     [--with-termnet             If you want a termified net support],[
  711.     if test x$withval = xyes; then
  712.         AC_DEFINE(USE_TERMNET)
  713.         termnet=true        
  714.     fi
  715. ])
  716.  
  717. dnl
  718. dnl The subshell support
  719. dnl
  720.  
  721. AC_MSG_CHECKING(for subshell support)
  722. AC_ARG_WITH(subshell,
  723.     [--with-subshell            If you want to use a concurrent shell],
  724.     if test x$withval = xoptional
  725.     then
  726.         AC_DEFINE(SUBSHELL_OPTIONAL)
  727.         AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
  728.         result="optional"
  729.     fi
  730.     if test x$withval = xyes
  731.         then 
  732.         AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
  733.         result="yes"
  734.     fi,
  735.     dnl Default: provide the subshell support on non-ultrix machines
  736.     if test $system = ULTRIX    
  737.     then
  738.         result=no
  739.     else
  740.         AC_DEFINE(HAVE_SUBSHELL_SUPPORT)
  741.         result=yes
  742.     fi
  743. )
  744. AC_MSG_RESULT($result)
  745. subshell="$result"
  746.  
  747. dnl
  748. dnl Check for GCC
  749. dnl
  750. if test x$GCC = x
  751. then
  752.     AC_DEFINE(OLD_TOOLS)
  753.     CPPFLAGS="$CPPFLAGS -Dinline="
  754. fi
  755.  
  756. dnl
  757. dnl This option is only inteded for being used by me :-)
  758. dnl It has some nasty hacks built in.
  759. dnl
  760. mem_debug="none"
  761. AC_ARG_WITH(debug, 
  762. [--with-debug               For use by developers only: activates -Wall and MAD],
  763.     [if test x$withval = xyes; then
  764.     CFLAGS="$CFLAGS -Wall"
  765.     mem_debug="Janne's MAD library"
  766.     AC_DEFINE(HAVE_MAD)
  767.     AC_DEFINE(MCDEBUG)
  768.     if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
  769.     then
  770.             CFLAGS="$CFLAGS -Wno-implicit"
  771.         fi
  772.     if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
  773.         :
  774.     else
  775.         if test $cc_uses_g = yes; then
  776.         CFLAGS="$CFLAGS -g"
  777.         fi
  778.     fi
  779.     AC_MSG_RESULT(compiling with -Wall and the memory leak detector)
  780. fi])
  781.  
  782. dnl
  783. dnl This option is only inteded for being used by me :-)
  784. dnl It has some nasty hacks built in.
  785. dnl
  786. AC_ARG_WITH(efence, 
  787. [--with-efence              Developers only: activates -Wall and efence],
  788.     [if test x$withval = xyes; then
  789.     CFLAGS="$CFLAGS -Wall"
  790.     AC_DEFINE(MCDEBUG)
  791.     LIBS="$LIBS -lefence"
  792.     if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
  793.     then
  794.             CFLAGS="$CFLAGS -Wno-implicit"
  795.         fi
  796.     if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
  797.         :
  798.     else
  799.         if test $cc_uses_g = yes; then
  800.         CFLAGS="$CFLAGS -g"
  801.         fi
  802.     fi
  803.     AC_MSG_RESULT(compiling with -Wall and Electric fence)
  804.     mem_debug="Electric Fence"
  805. fi])
  806.  
  807. dnl
  808. dnl To force mmap support
  809. dnl We use only part of the functionality of mmap, so on AIX,
  810. dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
  811. dnl
  812. AC_ARG_WITH(mmap, 
  813.     [--with-mmap                To force using the mmap call (AIX)],
  814.     [if test x$withval = xyes; then
  815.     AC_DEFINE(HAVE_MMAP)
  816.         AC_MSG_RESULT(forcing MMAP support)
  817. fi])
  818.  
  819. AC_DEFUN(AC_USE_TERMINFO,
  820.     AC_DEFINE(SLANG_TERMINFO)
  821.     AC_MSG_RESULT(Using SLang screen manager/terminfo)
  822.     slang_term=" with terminfo"
  823. )
  824.  
  825. AC_DEFUN(AC_USE_TERMCAP,
  826.     AC_MSG_RESULT(Using SLang screen manager/termcap)
  827.     AC_DEFINE(USE_TERMCAP)
  828.     LIBS="$LIBS -ltermcap"
  829.     slang_term=" with termcap"
  830. )
  831.     
  832. slang_check_lib=true
  833. slang_term=""
  834. AC_ARG_WITH(terminfo,
  835.         [--with-terminfo            SLANG: Force usage of terminfo],[
  836.     AC_USE_TERMINFO
  837.     slang_check_lib=false
  838.     ]
  839. )
  840.  
  841. AC_ARG_WITH(termcap,
  842.     [--with-termcap             SLANG: Force usage of termcap],[
  843.     AC_USE_TERMCAP
  844.     slang_check_lib=false
  845.     ]
  846. )
  847.  
  848. AC_DEFUN(AC_WITH_SLANG,
  849.     AC_DEFINE(HAVE_SLANG)
  850.     CPPFLAGS="$CPPFLAGS -I\$(slangdir)"
  851.     LIBSLANG="libmcslang.a"
  852.     search_ncurses=false
  853.     screen_manager="SLang"
  854.     LSLANG="-lmcslang"
  855.     fastdepslang=fastdepslang
  856.     if $slang_check_lib
  857.     then
  858.         use_terminfo=false
  859.         if test -d /usr/lib/terminfo; then
  860.         use_terminfo=true;
  861.         fi
  862.         if test -d /usr/share/lib/terminfo; then
  863.         use_terminfo=true;
  864.         fi
  865.         if test -d /usr/local/lib/terminfo; then
  866.         use_terminfo=true;
  867.         fi
  868.         if test -d /lib/terminfo; then
  869.         use_terminfo=true;
  870.         fi
  871.         if $use_terminfo; then
  872.         AC_USE_TERMINFO
  873.         else
  874.         AC_USE_TERMCAP
  875.         fi
  876.         fi
  877. )
  878.  
  879. LIBSLANG=""
  880. LSLANG=""
  881. fastdepslang=""
  882. AC_ARG_WITH(slang,
  883.     [--with-slang           Compile with the slang screen manager],[
  884.     if test x$withval = xyes; then
  885.         AC_WITH_SLANG
  886.     fi
  887. ])
  888.  
  889. AC_SUBST(LIBSLANG)
  890. AC_SUBST(LSLANG)
  891. AC_SUBST(fastdepslang)
  892.  
  893. TERMNET=""
  894. AC_DEFUN(AC_WITH_VFS, [
  895.     AC_DEFINE(USE_VFS)
  896.     if $use_net_code; then
  897.         AC_DEFINE(USE_NETCODE)
  898.         fi
  899.     LIBVFS="libvfs.a"
  900.     LVFS="-lvfs"
  901.     fastdepvfs=fastdepvfs
  902.     if test $have_socket = yes; then
  903.         mcserv="mcserv"
  904.         if $termnet; then
  905.         TERMNET="-ltermnet"
  906.         fi
  907.         fi
  908.     CPPFLAGS="$CPPFLAGS -I\$(vfsdir)"
  909.     AC_MSG_RESULT(Using the VFS switch code)
  910.     vfs_type="Midnight Commander Virtual File System"
  911. ])
  912. AC_SUBST(TERMNET)
  913.  
  914. LIBVFS=""
  915. LVFS=""
  916. fastdepvfs=""
  917. mcserv=""
  918. vfs_type="normal"
  919. AC_ARG_WITH(vfs,
  920.     [--with-vfs           Compile with the VFS code],
  921.     if test x$withval = xyes
  922.     then 
  923.         AC_WITH_VFS
  924.     else
  925.         vfs_flags=""
  926.     fi,
  927.     dnl Default: provide the VFS code
  928.     AC_WITH_VFS    
  929. )
  930. AC_SUBST(LIBVFS)
  931. AC_SUBST(LVFS)
  932. AC_SUBST(fastdepvfs)
  933. AC_SUBST(mcserv)
  934.  
  935. AC_ARG_WITH(netrc,
  936.     [--with-netrc               Compile with ftp .netrc support],[
  937.     AC_DEFINE(USE_NETRC)
  938.     AC_MSG_RESULT(ftpfs will have .netrc parsing code)
  939. ])
  940.  
  941. undelfs_o=""
  942. AC_ARG_WITH(ext2undel,
  943.         [--with-ext2undel[=ext2dir] Compile with ext2 undelete code],[
  944.     AC_DEFINE(USE_EXT2FSLIB)
  945.     AC_MSG_RESULT(With ext2fs file recovery code)
  946.     vfs_flags="$vfs_flags, undel-fs"
  947.     undelfs_o="undelfs.o"
  948.     LIBS="$LIBS -lext2fs -lcom_err"
  949. ])
  950. AC_SUBST(undelfs_o)
  951.     
  952. dnl
  953. dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
  954. dnl
  955. AC_DEFUN(AC_NCURSES, [
  956.     if $search_ncurses
  957.     then
  958.         if test -f $1/$2
  959.     then
  960.         AC_MSG_RESULT(Found ncurses on $1/$2)
  961.          LIBS="$LIBS $3"
  962.         CPPFLAGS="$CPPFLAGS $4"
  963.         search_ncurses=false
  964.         screen_manager=$5
  965.         AC_DEFINE(USE_NCURSES)
  966.     fi
  967.     fi
  968. ])
  969.  
  970. if $search_ncurses
  971. then
  972.     AC_CHECKING("location of ncurses.h file")
  973.  
  974.     AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
  975.     AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
  976.     AC_NCURSES(/usr/local/include, ncurses.h, -lncurses -L/usr/local/lib, -I/usr/local/include, "ncurses on /usr/local")
  977.     AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -lncurses -L/usr/local/lib -L/usr/local/lib/ncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
  978.  
  979.     AC_NCURSES(/usr/local/include/ncurses, curses.h, -lncurses -L/usr/local/lib, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
  980.  
  981.     AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
  982.  
  983.     dnl
  984.     dnl We couldn't find ncurses, try SysV curses
  985.     dnl
  986.     if $search_ncurses 
  987.     then
  988.         AC_EGREP_HEADER(init_color, /usr/include/curses.h,
  989.         AC_USE_SYSV_CURSES)
  990.     fi
  991.  
  992.     dnl
  993.     dnl Try SunOS 4.x /usr/5{lib,include} ncurses
  994.     dnl The flags SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
  995.     dnl should be replaced by a more fine grained selection routine
  996.     dnl
  997.     if $search_ncurses
  998.     then
  999.     if test -f /usr/5include/curses.h
  1000.     then
  1001.         AC_USE_SUNOS_CURSES
  1002.         fi
  1003.     fi
  1004. fi
  1005.  
  1006. if test "x$screen_manager" = "xunknown"; then
  1007.     AC_WITH_SLANG
  1008. fi
  1009.  
  1010. dnl
  1011. dnl The variables used for expanding the auto saver.
  1012. dnl
  1013. saver=""
  1014. saver_target=""
  1015. vcs=""
  1016. install_saver="no"
  1017. if test $system = Linux
  1018. then
  1019.     saver="install.saver"
  1020.     saver_target="cons.saver"
  1021.     vcs="install.create_vcs"
  1022.     install_saver="yes"
  1023. fi
  1024. AC_SUBST(saver_target)
  1025. AC_SUBST(saver)
  1026. AC_SUBST(vcs)
  1027.  
  1028. dnl
  1029. dnl We need sed in order to fix the library files 
  1030. dnl
  1031.     SEDCMD="sed 's/-man/$MANDOC/'"
  1032.     SEDCMD2="sed 's%@prefix@%\$(prefix)%'"
  1033. AC_SUBST(SEDCMD)
  1034. AC_SUBST(SEDCMD2)
  1035.  
  1036. if test x$no_xview = xyes; then
  1037.     :
  1038. else
  1039.     AC_LIB_XPM
  1040.     AC_X_SHAPE_EXTENSION
  1041.     if test x$ac_cv_has_xpm = xyes; then
  1042.         if test x$ac_cv_has_shape = xyes; then
  1043.             AC_DEFINE(HAVE_XPM_SHAPE)
  1044.         XPM_LIB=-lXpm
  1045.         XEXT_LIB=-lXext
  1046.         AC_SUBST(XPM_LIB)
  1047.         AC_SUBST(XEXT_LIB)
  1048.         fi
  1049.     fi
  1050. fi
  1051.  
  1052. dnl
  1053. dnl Check with $LIBS at the end so that it works with ELF libs.
  1054. dnl
  1055. AC_CHECK_LIB(termcap, tgoto, LIBS="$LIBS -ltermcap", $LIBS)
  1056. AC_CHECK_LIB(gpm, Gpm_Repeat,[
  1057.     AC_DEFINE(HAVE_LIBGPM)
  1058.         mouse_lib="GPM and xterm"
  1059.     LIBS="$LIBS -lgpm"],[
  1060.         if test $system = Linux
  1061.     then 
  1062.         AC_MSG_WARN("libgpm.a is missing or older than 0.18")
  1063.         fi
  1064.         ], $LIBS)
  1065.  
  1066. dnl This code should be moved to the ac_WITH_SLANG
  1067. case $screen_manager in
  1068. changequote(,)dnl
  1069.     [Ss][Ll][Aa][Nn][Gg]*)
  1070. changequote([, ])dnl
  1071.         AC_CHECK_LIB(curses,setupterm,[
  1072.             AC_TRY_COMPILE([
  1073. #include <curses.h>
  1074. #include <term.h>],[
  1075.    if (key_end == parm_insert_line)
  1076.      return 1;
  1077.    return 0;
  1078. ],[
  1079.             LIBS="$LIBS -lcurses"
  1080.             AC_DEFINE(USE_SETUPTERM)])])
  1081.         ;;
  1082. esac
  1083.  
  1084. LIBS="$LIBS $posix_libs"
  1085.  
  1086. insticons=
  1087. if test "x$no_xview" != "xyes"; then
  1088.     insticons=install_icons
  1089. fi
  1090. AC_SUBST(insticons)
  1091.  
  1092. CPPFLAGS="-I.. $CPPFLAGS"
  1093. AC_SUBST(CFLAGS)
  1094. AC_SUBST(CPPFLAGS)
  1095. AC_SUBST(LDFLAGS)
  1096. AC_SUBST(LIBS)
  1097.  
  1098. ac_cv_make_with_percent_rules=no
  1099. if test x$ac_cv_prog_gnu_make = xyes; then
  1100.     MCFG='include ../Make.common'
  1101.     MCFGR='include ./Make.common'
  1102.     MCF=/dev/null
  1103.     PHONY='.PHONY:'
  1104.     DOTDEPEND='ifeq (.depend,$(wildcard .depend)) \
  1105. include .depend \
  1106. endif'
  1107.     WRITEDEP=":"
  1108.     ac_cv_make_with_percent_rules=yes
  1109. else
  1110.     MCFG=""
  1111.     MCFGR=""
  1112.     MCF=./Make.common
  1113.     PHONY='#'
  1114.     DOTDEPEND=""
  1115.     WRITEDEP='sed "/^. \*\*\*Dependencies\*\*\*/,/^. \*\*\*End of dependencies\*\*\*/d" < Makefile > Makefile.conf; { cat Makefile.conf; echo "# ***Dependencies***Do not edit***"; cat .depend; echo "# ***End of dependencies***" } > Makefile; $(RMF) Makefile.conf .depend'
  1116. fi
  1117. AC_SUBST(PHONY)
  1118. AC_SUBST(DOTDEPEND)
  1119. AC_SUBST(WRITEDEP)
  1120. AC_SUBST(MCFG)
  1121. AC_SUBST(MCFGR)
  1122. AC_SUBST_FILE(MCF)
  1123.  
  1124. if test x$ac_cv_make_with_percent_rules = xyes; then
  1125.     PCENTRULE=""
  1126. else
  1127.     PCENTRULE="#"
  1128. fi
  1129. AC_SUBST(PCENTRULE)
  1130.  
  1131. AC_OUTPUT(Make.common Makefile doc/Makefile vfs/Makefile lib/Makefile lib/mc.ext tk/Makefile xv/Makefile src/Makefile slang/Makefile icons/Makefile mcfn_install)
  1132.  
  1133. if test x$srcdir != x; then
  1134.     if test $srcdir != .; then
  1135.     cp $srcdir/VERSION VERSION
  1136.     mkdir nt
  1137.     cp $srcdir/nt/Makefile nt/Makefile
  1138.     fi
  1139. fi
  1140.  
  1141. if test "x$screen_manager" = xSLang; then
  1142.     screen_manager="${screen_manager}${slang_term}"
  1143. fi
  1144.  
  1145. echo "
  1146. Configuration:
  1147.  
  1148.   Source code location:       ${srcdir}
  1149.   Compiler:                  ${CC}
  1150.   Compiler flags:             ${CFLAGS}
  1151.   File system:                ${vfs_type}
  1152.                   ${vfs_flags}
  1153.   Text mode screen manager:   ${screen_manager}
  1154.   Install console saver:      ${install_saver}
  1155.   Text mode mouse library:    ${mouse_lib}
  1156.   Debugger code:              ${mem_debug}
  1157.   With subshell support:      ${subshell}
  1158.   X11 versions:               ${xvers}
  1159.   Install path:              ${prefix}/bin, ${prefix}/lib/mc"
  1160. if test -n "$xv_bindir"; then
  1161. echo "  XView version install path: ${xv_bindir}"
  1162. fi
  1163. echo ""
  1164.